home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Tools&Utilities / TouchMe 1.2□ / touchMe 1.2 Folder / touchMe source codes / CW11 PP source / source / Common Lib / UFileTools.h < prev    next >
Encoding:
Text File  |  1997-04-25  |  2.8 KB  |  127 lines  |  [TEXT/CWIE]

  1. // ==================================================
  2. //    UFileTools.h
  3. //    Copyright (C) 1994-1997 Mizutori Tetsuya
  4. //    March 5, 1997
  5. // ==================================================
  6. //    All documents are pretty-printed in 10-point Geneva font.
  7.  
  8. #pragma once
  9.  
  10. #include <StandardFile.h>
  11.  
  12.  
  13. typedef enum {
  14.     fileType_Volume    = 1,
  15.     fileType_Folder,
  16.     fileType_File,
  17.     fileType_Unknown,
  18.     fileType_END
  19. } EFileType;
  20.  
  21.  
  22. class    UFileTools {
  23.  
  24. public:
  25.                 UFileTools();
  26.                 ~UFileTools();
  27.  
  28. public:
  29.  
  30.     // Get the creation/modification date time of the given FSSpec
  31.     static OSErr    GetFSSpecDateTime(
  32.                     FSSpec &             inFSSpec,
  33.                     unsigned long &        outCreationDate,
  34.                     unsigned long &        outModificationDate );
  35.  
  36.     // Set the creation/modification date time of the given FSSpec
  37.     static OSErr    SetFSSpecDateTime(
  38.                     FSSpec &            inFSSpec,
  39.                     unsigned long        inCreationDate,
  40.                     unsigned long        inModificationDate );
  41.  
  42. private:
  43.  
  44.     static OSErr    GetFileDateTime(
  45.                     FSSpec &            inFSSpec,
  46.                     unsigned long &        outCreationDate,
  47.                     unsigned long &        outModificationDate );
  48.  
  49.     static OSErr    SetFileDateTime(
  50.                     FSSpec &            inFSSpec,
  51.                     unsigned long        inCreationDate,
  52.                     unsigned long        inModificationDate );
  53.  
  54.     static OSErr    GetFolderDateTime(
  55.                     FSSpec &            inFSSpec,
  56.                     unsigned long &        outCreationDate,
  57.                     unsigned long &        outModificationDate );
  58.  
  59.     static OSErr    SetFolderDateTime(
  60.                     FSSpec &            inFSSpec,
  61.                     unsigned long        inCreationDate,
  62.                     unsigned long        inModificationDate );
  63.  
  64. public:
  65.  
  66.     // Update the finder's folder status
  67.     static OSErr    TouchDir(
  68.                     short            inVRefNum,
  69.                     long            inDirID );
  70.  
  71.     // Test the file type of a particular file
  72.     static EFileType    GetFSSpecType(
  73.                     FSSpec &        inFSSpec );
  74.  
  75.     static OSErr    QueryFile(
  76.                     FSSpec &        inFSSpec,
  77.                     EFileType &    outFileType,
  78.                     long &        outFileID );
  79.  
  80.     // Search a particure directory for the files in it.
  81.     static OSErr    SearchDirectory(
  82.                     long            inIndex,        // begins with one.
  83.                     FSSpec &        inDirSpec,
  84.                     FSSpec &        outFSSpec,
  85.                     EFileType &    outFileType );
  86.  
  87.     static OSErr    SearchDirectory(
  88.                     long            inIndex,        // begins with one.
  89.                     short            inVRefNum,
  90.                     long            inDirID,
  91.                     FSSpec &        outFSSpec,
  92.                     EFileType &    outFileType );
  93.  
  94.     // Get the full pathname of a particular file.
  95.     static OSErr    GetFullPathname(
  96.                     const FSSpec &    inFSSpec,
  97.                     Str255        outPathname,
  98.                     Boolean        inAddFilename    = false );
  99.  
  100.     // Get the file spec of the current application process.
  101.     static OSErr    GetCurrentApplicationFile(
  102.                     FSSpec &        outFSSpec );
  103.  
  104. public:
  105.  
  106.     static void        PStrCopy(
  107.                     Str255            dstP,
  108.                     const Str255        srcP );
  109.  
  110.     static void        PStrCopy(
  111.                     Str255            dstP,
  112.                     const unsigned char *    srcP,
  113.                     const long            length );
  114.  
  115.     static void        PStrAppend(
  116.                     Str255            dstP,
  117.                     const Str255        srcP );
  118.  
  119.     static void        PStrAppend(
  120.                     Str255            dstP,
  121.                     const unsigned char *    srcP,
  122.                     const long            length );
  123.  
  124. };
  125.  
  126. // end of definitions
  127.